//
//  XMOfficialReminderView.m
//  XunMi
//
//  Created by MacBook on 2024/5/10.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMOfficialReminderView.h"

@interface XMOfficialReminderView ()
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@property (nonatomic, strong) XMOfficialReminderModel *model;

@end

@implementation XMOfficialReminderView

- (void)awakeFromNib {
    [super awakeFromNib];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
    [self.imgView addGestureRecognizer:tap];
}

- (void)setupModel:(XMOfficialReminderModel *)model complete:(void (^)(void))complete {
    self.model = model;
    [self.imgView sd_setImageWithURL:kStringToUrl(model.image.file_url)
                    placeholderImage:kDefaultCoverImg
                           completed:^(UIImage *_Nullable image, NSError *_Nullable error, SDImageCacheType cacheType, NSURL *_Nullable imageURL) {
        if (complete) {
            complete();
        }
    }];
}

- (void)tap {
    if (self.tapBlock) {
        self.tapBlock(self.model);
    }
}

- (IBAction)close:(id)sender {
    if (self.closeBlock) {
        self.closeBlock();
    }
}


@end


@implementation XMOfficialReminderModel


+ (NSDictionary *)mj_objectClassInArray {
    return @{@"image": @"XMFileModel"};
}
// 当字典转模型完毕时调用
- (void)mj_didConvertToObjectWithKeyValues:(NSDictionary *)keyValues {
    
}

@end


